import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入购物车模块
import Cart from '@/views/Cart/Index'

// 导入 404 模块
import NotFound from '@/views/NotFound'

Vue.use(VueRouter)

const routes = [
  // 路由重定向
  {
    path: '/',
    redirect: '/cart'
  },
  // 购物车路由
  {
    path: '/cart',
    component: Cart
  },
  // 404路由
  {
    path: '*',
    component: NotFound
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
